#pragma once
#include"const.h"
class MsgNode
{
public:
	MsgNode(short max_len) :_total_len(max_len), _cur_len(0) {
		_data = new char[max_len + 1];
		_data[max_len] = '\0';
	}

	~MsgNode() {
		std::cout << "destruct MsgNode" << std::endl;
		delete[]_data;
	}
	void Clear() {
		_cur_len = 0;
		::memset(_data, 0, _total_len);
	}

	short _cur_len;
	short _total_len;
	char* _data;
};

class RecvNode :public MsgNode
{
public:
	RecvNode(short max_len, short msg_id);

	short _msg_id;
};
class SendNode :public MsgNode {
public:
	SendNode(const char* msg, short max_len, short msg_id);

	short _msg_id;
};